<div class="content-wrapper">
	<section class="content-header">
		<h1>用户登录日志</h1>
		<ol class="breadcrumb">
			<li><a href="/admin"><i class="fa fa-dashboard"></i> 首页</a></li>
			<li class="active">日志管理</li>
			<li class="active">登录列表</li>
		</ol>
	</section>
	<section class="content">
		<div class="box">
			<div class="box-header with-border">
				<form class="form-inline" action="/admin/log/loginLog" method="get">
					<div class="form-group">
						<label for="user_id">用户 </label> 
						<select class="form-control" name="user_id" id="user_id">
                    		<option value="-1">选择用户</option>
                    		<foreach name="userList" item="user">
                            	<option value="{$user.id}" <if condition="$user['id'] eq $user_id">selected</if>>{$user.name}</option>
                            </foreach>                            			
                    	</select>
					</div>
					<div class="form-group">
						<label for="start_time">登录时间 </label>
						<div class="input-group date">
							<div class="input-group-addon">
								<i class="fa fa-calendar"></i>
							</div>
							<input type="text" id="start_time" name="start_time" value="{$start_time}" readonly class="form-control pull-right datepicker">
						</div>
						<div class="input-group date">
							<div class="input-group-addon">
								<i class="fa fa-calendar"></i>
							</div>
							<input type="text" id="end_time" name="end_time" value="{$end_time}" readonly class="form-control pull-right datepicker">
						</div>
					</div>
					<button type="submit" class="btn btn-info">查询</button>&nbsp;					
				</form>
			</div>
			<div class="box-body">
				<table class="table table-bordered">
					<tbody>
						<tr>
							<th style="width: 60px">ID</th>
							<th>用户</th>
							<th>IP</th>
							<th>登录时间</th>
						</tr>
						<foreach name="logList" item="log">
							<tr>
								<td>{$log.id}</td>
								<td>{$log.name}</td>
								<td>{$log.ip}</td>
								<td>{$log.create_time|date="Y-m-d H:i:s",###}</td>
							</tr>
						</foreach>
					</tbody>
				</table>
			</div>
			<div class="box-footer clearfix">{$page_html}</div>			
		</div>
	</section>
</div>

<script type="text/javascript">
	$(function() {
		$('.datepicker').datepicker({
			autoclose : true,
			format : 'yyyy-mm-dd'
		});

		$("#save-btn").click(function() {
			var id = $("#id").val();
			var name = $.trim($("#name").val());

			if (name == '') {
				ArtDialogHlp.showInfo('提示', '请填写用户组名');
				return false;
			}

			$.post('/admin/auth/saveUserGroup', {
				id : id,
				name : name
			}, function(data) {
				if (data.Code == 999) {
					ArtDialogHlp.showInfo('提示', '操作成功', function() {
						window.location.href = '/admin/auth/userGroupList';
					});
				} else {
					ArtDialogHlp.showInfo('提示', data.Msg);
				}
			}, 'json');
		});
	});
</script>